package com.itheima.demoStringBuilder;
//判断是不是对称字符串
import java.util.Scanner;

public class Demo03StringBuilder {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入字符串,true为对称,false不对称:");
        String s = sc.next();
        String str = reverse(s);//str接收反转后的字符串
        System.out.println(s.equals(str));//比较反转前后的字符串
    }

    public static String reverse(String str){
        /*StringBuilder sb = new StringBuilder(str);
        return sb.reverse().toString();*/

        return  new StringBuilder(str).reverse().toString();
    }
}
